chore(db): sync schema dump with merged migrations - #997
Merged
Conversation
Regenerate sql/01_schema.sql and sql/03_migration_tracker.sql via `make test-schema`. The committed dump had drifted behind several already-merged migrations (~0218-0228); this brings the test-template schema back in sync. No functional change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Regenerating the schema dump activates the delta-based social-aggregate triggers introduced in #898 (on_save/on_follow/on_repost now fire on INSERT OR UPDATE and adjust counts by a delta instead of recomputing). The shared aggregate_user fixture seeded user 1's track_save_count to 20, which the old recompute trigger overwrote but the delta trigger instead treats as a baseline (20 + 3 seeded saves = 23), breaking TestGetUsersAccount. Seed the pre-save baseline of 0 so the trigger builds the intended count of 3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
rickyrombo
added a commit
that referenced
this pull request
Aug 3, 2026
…StatsJob) (#998) >⚠️ **Stacked on #997** (base branch is `mjp-sync-test-schema`). Merge #997 first; this PR's schema diff shows only the new objects because the pending dump drift lives in #997. After #997 merges, this rebases onto `main` cleanly. ## What Adds `CoinStatsOnchainJob` — an on-chain replacement for the Birdeye-backed `CoinStatsJob`, which is ~99.6% of our Birdeye compute-unit spend. It derives the coin stats the product actually renders from data we already index on-chain, instead of calling Birdeye: | Field | Source | |---|---| | price | `artist_coin_prices` view (Meteora DBC/DAMM v2 pools) | | holder | `sol_token_account_balances` (distinct owners, balance > 0) | | liquidity | pool **TVL** = base-side USD + quote-side USD (real reserves) | | total_supply / market_cap | RPC `getTokenSupply`; `price × supply` | | total_volume(_usd) | running accumulator over pool quote-vault balance changes | | history_24h_price / price_change_24h_percent | new hourly price-history table | ## Shadow rollout The job writes a **new `artist_coin_stats_onchain` table** and runs **alongside** the existing `CoinStatsJob` (both every 15 min). Consumers still read the live `artist_coin_stats`, so there's **zero product impact**. The new `artist_coin_stats_comparison` view exposes per-coin Birdeye-vs-on-chain deltas for validation. Once validated, a follow-up PR repoints consumers and deletes `CoinStatsJob` + the unused Birdeye methods. `AudioPriceJob` (the AUDIO→USD anchor, still Birdeye) is intentionally out of scope. ## Also - New tables: `artist_coin_stats_onchain`, `artist_coin_price_history`, `artist_coin_volume_accumulator` (migrations 0229–0231). - `database/seed.go`: base rows for the new tables + `sol_meteora_dbc_pools`. - Test `coin_stats_onchain_test.go` seeds a DBC coin and asserts every derived field + the AUDIO no-clobber guard. ## Known fidelity gaps vs Birdeye We track one canonical pool per coin, so a graduated coin with secondary/external markets will have understated liquidity/volume (price stays close via arbitrage); there's also a brief migration-lag window. The comparison view is the detector — review it before cutover. 24h change is blank for the first ~24h after deploy (no snapshot yet). ## Test `go test ./jobs/ ./database/` pass; full build/vet clean; regenerated dump loads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regenerates
sql/01_schema.sqlandsql/03_migration_tracker.sqlviamake test-schema.The committed schema dump had drifted behind several already-merged migrations (~0218–0228) that were never dumped. Since the Go test suite builds its Postgres template from
sql/01_schema.sql(not by running migrations), this brings the test-template schema back in sync with the migrations onmain.No functional change — dump/tracker regeneration only.
🤖 Generated with Claude Code